﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace QuTouTiaoAssist.Entity
{
    class QttImgCaptchaInfo
    {
        [JsonProperty("data")]
        public string ImageData;
        [JsonProperty("id")]
        public string ImageId;

        public Image AnalyzeImageData()
        {
            try
            {
                byte[] imgBytes = Convert.FromBase64String(this.ImageData);
                using (var stream = new MemoryStream())
                {
                    stream.Write(imgBytes, 0, imgBytes.Length);
                    return Image.FromStream(stream);
                }
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
